const express = require('express')
const  connection=require('../mysql/mysql')

connection.connect();

const router=express.Router();
router.get("/business",function(req,res){
  connection.query('SELECT * FROM sp', function(error, results, fields) {
    if (error) throw error;
    res.send(results)
  });
  // connection.end();
});

router.get("/classification",function(req,res){
  connection.query('SELECT * FROM sjimg', function(error, results, fields) {
    if (error) throw error;
    res.send(results)
  });
  // connection.end();
});

router.get("/function",function(req,res){
  connection.query('SELECT * FROM function', function(error, results, fields) {
    if (error) throw error;
    res.send(results)
  });
  // connection.end();
});

router.get("/fuwu",function(req,res){
  connection.query('SELECT * FROM fuwu', function(error, results, fields) {
    if (error) throw error;
    res.send(results)
  });
  // connection.end();
});

router.get("/recommend",function(req,res){
  connection.query('SELECT * FROM recommend', function(error, results, fields) {
    if (error) throw error;
    res.send(results)
  });
  // connection.end();
});

router.get("/items",function(req,res){
  connection.query('SELECT * FROM items', function(error, results, fields) {
    if (error) throw error;
    res.send(results)
  });
  // connection.end();
});

router.get("/discount",function(req,res){
  connection.query('SELECT * FROM discount', function(error, results, fields) {
    if (error) throw error;
    res.send(results)
  });
  // connection.end();
});

router.get("/hotsale",function(req,res){
  connection.query('SELECT * FROM Hotsale', function(error, results, fields) {
    if (error) throw error;
    res.send(results)
  });
  // connection.end();
});

router.get("/qita",function(req,res){
  connection.query('SELECT * FROM qita', function(error, results, fields) {
    if (error) throw error;
    res.send(results)
  });
  // connection.end();
});

router.get("/evaluate",function(req,res){
  connection.query('SELECT * FROM evaluate', function(error, results, fields) {
    if (error) throw error;
    res.send(results)
  });
  // connection.end();
});



module.exports =router
